from django.db import models
from django.contrib.auth import get_user_model
User = get_user_model()

class Progress(models.Model):
    title = models.CharField(max_length=100)
    description = models.TextField()
    completed = models.BooleanField(default=False)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title
# progress_tracking/models.py

from django.db import models

class Project(models.Model):
    title = models.CharField(verbose_name='项目名称', max_length=200)
    description = models.TextField(verbose_name='描述', blank=True, null=True)
    start_date = models.DateField(verbose_name='开始日期')
    end_date = models.DateField(verbose_name='截止日期', blank=True, null=True)
    completed = models.BooleanField(verbose_name='是否完成', default=False)
    students = models.ManyToManyField(User, related_name='projects', blank=True, verbose_name="学生")
    def __str__(self):
        return self.title
class ProgressReport(models.Model):
    project = models.ForeignKey('Project', on_delete=models.CASCADE, verbose_name='所属课题')
    student = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='学生')
    title = models.CharField(max_length=200, verbose_name='进度标题')
    content = models.TextField(verbose_name='进度内容')
    submitted_at = models.DateTimeField(auto_now_add=True, verbose_name='提交时间')
    file = models.FileField(upload_to='progress_files/', null=True, blank=True, verbose_name='附件')

    def __str__(self):
        return f"{self.project.title} - {self.title}"